package class_0908red_black_trees;

public class RedBlackTreeTest {
    public static void main1(String[] args) {
        RedBlackTree<Integer, String> tree = new RedBlackTree<>();

        // 插入测试
        tree.insert(20, "A");
        tree.insert(15, "B");
        tree.insert(25, "C");
        tree.insert(10, "D");
        tree.insert(5, "E");
        tree.insert(30, "F");
        tree.insert(35, "G");
        tree.insert(17, "H");

        System.out.println("插入后红黑树中序遍历：");
        tree.inOrderTraversal();  // 假设你已经实现了中序遍历的方法
        System.out.println();
        // 搜索测试
        System.out.println("搜索节点 25: " + tree.search(25));  // 应该输出 C

        // 删除测试
        tree.delete(25);
        System.out.println("删除节点 25 后中序遍历：");
        tree.inOrderTraversal();

        // 再次插入测试
        tree.insert(40, "I");
        System.out.println("再次插入后红黑树中序遍历：");
        tree.inOrderTraversal();
    }
}
